import React, { Component, createContext } from 'react'
import { Provider } from '../utils/context'
import Father from './Father'

// const { Provider, Consumer } = createContext()
// Provider  提供数据
// Consumer  使用数据

class GrandFather extends Component {
    state = {
        num: 8888
    }
    render() {
        const { num } = this.state
        return (
            <div>
                <h2>
                    GrandFather -- {num}
                </h2>
                {/* <button onClick={() => {
                    this.setState({
                        num: this.state.num += 1
                    })
                }}>++</button> */}
                <Provider value={num}>
                    <Father />
                </Provider>
            </div>
        )
    }
}

// export {
//     Consumer
// }

export default GrandFather
